package co.yixiang.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

public class RandonOrderNoUtil {

    public static String getOrderIdByTime() {
        SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMddHHmmss");
        String newDate=sdf.format(new Date());
        String result="";
        Random random=new Random();
        for(int i=0;i<3;i++){
            result+=random.nextInt(10);
        }
        return newDate+result;
    }

    public static String getRefereeCode() {
        SimpleDateFormat sdf=new SimpleDateFormat("HHmmss");
        String newDate=sdf.format(new Date());
        String result="";
        Random random=new Random();
        for(int i=0;i<3;i++){
            result+=random.nextInt(10);
        }
        return newDate+result;
    }

    public static String getSixMsg() {
        String result="";
        Random random=new Random();
        for(int i=0;i<3;i++){
            result+=random.nextInt(10);
        }
        return result;
    }

    public static String getInviteCode(){
        String randString = "0123456789abcdefghijklmnopqrstuvwxyz";//随机产生的字符串
        String inviteCode = "";
        for(int i=0;i<6;i++){
            inviteCode += String.valueOf(String.valueOf(randString.charAt(new Random().nextInt(randString.length()))));
        }
        return inviteCode;
    }

}
